import java.awt.Color;
import java.awt.Graphics;
import java.awt.Panel;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class HolesAWT extends Panel
{
	private static final long serialVersionUID = 1L;
	private int is = 0;
	private String imgstr = "";
	private int column = 0;

	/**Gets path to image file
	 * @return path string**/
	public String getImgstr() 
	{
		return imgstr;
	}
	
	/**Sets path to image file
	 * @param imgstr  path string**/
	public void setImgstr(String imgstr) 
	{
		this.imgstr = imgstr;
	}
	
	/**@return 0 if empty, 1 or 2 depending on the color**/
	public int getIs() 
	{
		return is;
	}
	
	/**Value is 0 if empty, 1 or 2 otherwise 
	 * @param is  value can be 0,1 or 2**/
	public void setIs(int is) 
	{
		this.is = is;
	}
	
	/**Sets the number of the column that has been clicked
	 * @param column  the number of the column**/
	public void setColumn(int column) 
	{
		this.column = column;
	}
	
	/**@return the number of the column that has been clicked**/
	public int getColumn() 
	{
		return column;
	}
	
	/**class constructor **/
	public HolesAWT()
	{
		this.setBackground(Color.BLACK);
	}
	
	/**Override of paint method**/
	public void paint(Graphics g)
	{
		BufferedImage coin = null;
		switch (is)
		{
		case 0: //none
			try
			{
				coin = ImageIO.read(new File(getImgstr()));
				g.drawImage(coin, 0, 0, this);
			}
			catch (IOException e) {}
			break;
		case 1: //red
			try 
			{
				coin = ImageIO.read(new File(getImgstr()));
				g.drawImage(coin, 0, 0, this);
			} 
			catch (IOException e) {}
			break;
		case 2: //green
			try 
			{
				coin = ImageIO.read(new File(getImgstr()));
				g.drawImage(coin, 0, 0, this);
			} 
			catch (IOException e) {}
			break;
		}
	}	
}
